package com.leadership.entity.actionlearning;

import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import com.leadership.entity.user.User;

/**
 * 刻意行动计划单项
 * 
 * @author mohanlan
 *
 */
@Entity
@Table(name = "action_learning_anchor")
public class ActionLearningAnchor {
    
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;
    
    /** 所属人 */
    @ManyToOne(fetch = FetchType.LAZY, optional = false)
    private User user;
    
    /**
     * 所属刻意学习计划表
     */
    @ManyToOne(fetch = FetchType.LAZY, optional = true)
    private ActionLearning actionLearning;
    
    /** 刻意学习内容 */
    private String anchorName;
    
    /** 所属anchor标识 */
    private String originalAnchor;
    
    /** 类型 */
    @Enumerated(EnumType.STRING)
    private AnchorType anchorType;
    
    /**
     * 所需支持
     */
    private String support;
    
    /**
     * 状态
     */
    @Enumerated(EnumType.STRING)
    private Status status;
    
    /**
     * 预估完成日期
     */
    private Date endDate;
    
    @Column(name = "is_disabled")
    private boolean disabled;
    
    /**
     * The default constructor
     */
    public ActionLearningAnchor() {
    }
    
    /**
     * 
     * @param endDate
     * @param status
     * @param anchorName
     * @param originalAnchor
     * @param type
     * @param support
     * @param user
     * @param actionLearning
     */
    public ActionLearningAnchor(Date endDate, Status status, String anchorName, String originalAnchor, AnchorType type, String support, User user, ActionLearning actionLearning) {
        this.endDate = endDate;
        this.status = status;
        this.anchorName = anchorName;
        this.originalAnchor = originalAnchor;
        this.anchorType = type;
        this.support = support;
        this.user = user;
        this.actionLearning = actionLearning;
        this.disabled = false;
    }
     
    /**
     * 
     * @param status
     * @return
     */
    public ActionLearningAnchor changeStatus(Status status) {
        this.status = status;
        return this;
    }

    /**
     * @return the id
     */
    public Long getId() {
        return id;
    }

    /**
     * @return the user
     */
    public User getUser() {
        return user;
    }

    /**
     * @return the actionLearning
     */
    public ActionLearning getActionLearning() {
        return actionLearning;
    }

    /**
     * @return the anchorName
     */
    public String getAnchorName() {
        return anchorName;
    }

    /**
     * @return the originalAnchor
     */
    public String getOriginalAnchor() {
        return originalAnchor;
    }

    /**
     * @return the anchorType
     */
    public AnchorType getAnchorType() {
        return anchorType;
    }

    /**
     * @return the support
     */
    public String getSupport() {
        return support;
    }

    /**
     * @return the status
     */
    public Status getStatus() {
        return status;
    }

    /**
     * @return the endDate
     */
    public Date getEndDate() {
        return endDate;
    }

    /**
     * @return the disabled
     */
    public boolean isDisabled() {
        return disabled;
    }

    /**
     * @param id the id to set
     */
    public void setId(Long id) {
        this.id = id;
    }

    /**
     * @param user the user to set
     */
    public void setUser(User user) {
        this.user = user;
    }

    /**
     * @param actionLearning the actionLearning to set
     */
    public void setActionLearning(ActionLearning actionLearning) {
        this.actionLearning = actionLearning;
    }

    /**
     * @param anchorName the anchorName to set
     */
    public void setAnchorName(String anchorName) {
        this.anchorName = anchorName;
    }

    /**
     * @param originalAnchor the originalAnchor to set
     */
    public void setOriginalAnchor(String originalAnchor) {
        this.originalAnchor = originalAnchor;
    }

    /**
     * @param anchorType the anchorType to set
     */
    public void setAnchorType(AnchorType anchorType) {
        this.anchorType = anchorType;
    }

    /**
     * @param support the support to set
     */
    public void setSupport(String support) {
        this.support = support;
    }

    /**
     * @param status the status to set
     */
    public void setStatus(Status status) {
        this.status = status;
    }

    /**
     * @param endDate the endDate to set
     */
    public void setEndDate(Date endDate) {
        this.endDate = endDate;
    }

    /**
     * @param disabled the disabled to set
     */
    public void setDisabled(boolean disabled) {
        this.disabled = disabled;
    }
}
